<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="projects.project" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="createProject" class="projects.project"></jsp:useBean>
<jsp:setProperty property="*" name="createProject"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>

<%
	if (session.getAttribute("loggedIn") == null) {
		response.sendRedirect("../User/index.jsp");
		}
%>

<body>
<% 
	project prj = new project();
	prj.setClientId(Integer.parseInt(request.getParameter("client")));
	prj.setName(request.getParameter("prjName"));
	prj.setDescription(request.getParameter("prjDesc"));
	prj.setStartDate(request.getParameter("startDate"));
	prj.setEndDate(request.getParameter("endDate"));
	prj.setEffort(Double.parseDouble(request.getParameter("prjEffort")));
	prj.setProjectStateId(Integer.parseInt(request.getParameter("projectState")));
	prj.setProjectStateReason(request.getParameter("stateReason"));
	prj.setEstimatedCost(Double.parseDouble(request.getParameter("estimatedCost")));
	if(prj.createProject()==true && prj.assignTeamMember(Integer.parseInt(request.getParameter("hEmployeeId")), 3) == true)
	{
		session.setAttribute("createProject", "true");
		response.sendRedirect("createNewProject.jsp"); 
	}
	else
	{
		response.sendRedirect("createNewProject.jsp?success=false");
	}
%>
</body>
</html>